#coding=utf-8
__author__ = '药师Aric'
'''
'''
from ftplib import FTP
import os
#
configer = {
    'cjx' : {
        'host' : '120.31.134.20',
        'port' : 21,
        'user' : 'ftp_2015cjx',
        'password' : '2015cjxZNH$%(098',
        'path' : 'E:\cjx'
    }
}

project = 'cjx'
cfg = configer[project]
print(cfg)

try:
    ftp = FTP()
    # ftp.set_debuglevel(2) #打开调试级别2，显示详细信息
    ftp.connect(cfg['host'], cfg['port'])
    ftp.login(cfg['user'], cfg['password'])
    print(ftp.dir())

    #git
    path = cfg['path'].split(':')
    letter = path[0] #得到盘符 如：e 盘
    #git show --name-only
    # os.system(letter + ': & cd ' + cfg['path'] + ' & git log --name-only')
    p = os.popen(letter + ': & cd ' + cfg['path'] + '  & git log --name-only') #得到git最后更新文件列表
    print(p.read())
except Exception as e:
    print(e)
finally:
    ftp.quit()



